package io.gitee.zhangbinhub.admin.entity

import io.swagger.v3.oas.annotations.media.Schema
import jakarta.persistence.*

/**
 * @since JDK 11
 */
@Entity
@Table(
    name = "t_my_process_instance", indexes = [
        Index(columnList = "userId,processInstanceId", unique = true),
        Index(columnList = "userId,processDefinitionKey,businessKey,startTime"),
        Index(columnList = "userId,startTime"),
        Index(columnList = "userId,startUserId")
    ]
)
@Schema(description = "我处理过的流程实例")
data class MyProcessInstance(
    @Id
    @GeneratedValue(strategy = GenerationType.UUID)
    @Column(length = 36, nullable = false)
    @field:Schema(description = "ID")
    var id: String = "",

    @Column(nullable = false)
    @field:Schema(description = "流程实例id")
    var processInstanceId: Long = 0,

    @Column(nullable = false)
    @field:Schema(description = "流程定义键")
    var processDefinitionKey: String = "",

    @Column(nullable = false)
    @field:Schema(description = "业务键")
    var businessKey: String = "",

    @field:Schema(description = "发起人")
    var startUserId: String? = null,

    @Column(nullable = false)
    @field:Schema(description = "处理人")
    var userId: String = "",

    @Column(nullable = false)
    @field:Schema(description = "开始时间")
    var startTime: Long = 0
)
